From ad47474431253ad7edc4609ed26e68e90ffe5bf4 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Thu, 28 Sep 2006 13:44:24 +0100 Subject: [PATCH] [XEN] Remove weak-extern definitions from symbols.c. Instead we have an explicit set of dummy symbol definitions for the inital link of the Xen image. Signed-off-by: Keir Fraser --- xen/arch/ia64/Makefile | 15 ++++++++++----- xen/arch/powerpc/Makefile | 3 ++- xen/arch/x86/Makefile | 13 +++++++++---- xen/common/symbols-dummy.c | 16 ++++++++++++++++ xen/common/symbols.c | 13 ++++++------- 5 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 xen/common/symbols-dummy.c diff --git a/xen/arch/ia64/Makefile b/xen/arch/ia64/Makefile index 1c95e6203d..41f5ac5e82 100644 --- a/xen/arch/ia64/Makefile +++ b/xen/arch/ia64/Makefile @@ -4,22 +4,27 @@ subdir-y += linux subdir-y += linux-xen $(TARGET)-syms: linux-xen/head.o $(ALL_OBJS) xen.lds.s + $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/common/symbols-dummy.o $(LD) $(LDFLAGS) -T xen.lds.s -N \ - -Map map.out linux-xen/head.o $(ALL_OBJS) -o $@ + -Map map.out linux-xen/head.o $(ALL_OBJS) \ + $(BASEDIR)/common/symbols-dummy.o -o $@ $(NM) -n $@ | $(BASEDIR)/tools/symbols > $(BASEDIR)/xen-syms.S $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/xen-syms.o $(LD) $(LDFLAGS) -T xen.lds.s -N \ - -Map map.out linux-xen/head.o $(ALL_OBJS) $(BASEDIR)/xen-syms.o -o $@ + -Map map.out linux-xen/head.o $(ALL_OBJS) \ + $(BASEDIR)/xen-syms.o -o $@ $(NM) -n $@ | $(BASEDIR)/tools/symbols >$(BASEDIR)/xen-syms.S $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/xen-syms.o $(LD) $(LDFLAGS) -T xen.lds.s -N \ - -Map map.out linux-xen/head.o $(ALL_OBJS) $(BASEDIR)/xen-syms.o -o $@ + -Map map.out linux-xen/head.o $(ALL_OBJS) \ + $(BASEDIR)/xen-syms.o -o $@ rm -f $(BASEDIR)/xen-syms.S $(BASEDIR)/xen-syms.o $(TARGET): $(TARGET)-syms $(OBJCOPY) -R .note -R .comment -S $(TARGET)-syms $@ - $(NM) -n $(TARGET)-syms | grep -v '\( [aUw] \)\|\(__crc_\)\|\( \$[adt]\)'\ - > $(BASEDIR)/System.map + $(NM) -n $(TARGET)-syms | \ + grep -v '\( [aUw] \)\|\(__crc_\)\|\( \$[adt]\)' \ + > $(BASEDIR)/System.map # Headers do not depend on auto-generated header, but object files do. HDRS := $(subst $(BASEDIR)/include/asm-ia64/asm-xsi-offsets.h,,$(HDRS)) diff --git a/xen/arch/powerpc/Makefile b/xen/arch/powerpc/Makefile index ce855e2e42..837364acc1 100644 --- a/xen/arch/powerpc/Makefile +++ b/xen/arch/powerpc/Makefile @@ -101,7 +101,8 @@ TARGET_OPTS = $(OMAGIC) -Wl,-Ttext,$(xen_link_base),-T,xen.lds TARGET_OPTS += start.o $(ALL_OBJS) .xen-syms: start.o $(ALL_OBJS) xen.lds - $(CC) $(CFLAGS) $(TARGET_OPTS) -o $@ + $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/common/symbols-dummy.o + $(CC) $(CFLAGS) $(TARGET_OPTS) $(BASEDIR)/common/symbols-dummy.o -o $@ NM=$(CROSS_COMPILE)nm new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 991fa436b3..8b008562e5 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -46,19 +46,24 @@ obj-$(crash_debug) += gdbstub.o $(TARGET): $(TARGET)-syms boot/mkelf32 ./boot/mkelf32 $(TARGET)-syms $(TARGET) 0x100000 \ - `$(NM) $(TARGET)-syms | sort | tail -n 1 | sed -e 's/^\([^ ]*\).*/0x\1/'` + `$(NM) $(TARGET)-syms | sort | tail -n 1 | \ + sed -e 's/^\([^ ]*\).*/0x\1/'` $(TARGET)-syms: boot/$(TARGET_SUBARCH).o $(ALL_OBJS) xen.lds + $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/common/symbols-dummy.o $(LD) $(LDFLAGS) -T xen.lds -N \ - boot/$(TARGET_SUBARCH).o $(ALL_OBJS) -o $@ + boot/$(TARGET_SUBARCH).o $(ALL_OBJS) \ + $(BASEDIR)/common/symbols-dummy.o -o $@ $(NM) -n $@ | $(BASEDIR)/tools/symbols >$(BASEDIR)/xen-syms.S $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/xen-syms.o $(LD) $(LDFLAGS) -T xen.lds -N \ - boot/$(TARGET_SUBARCH).o $(ALL_OBJS) $(BASEDIR)/xen-syms.o -o $@ + boot/$(TARGET_SUBARCH).o $(ALL_OBJS) \ + $(BASEDIR)/xen-syms.o -o $@ $(NM) -n $@ | $(BASEDIR)/tools/symbols >$(BASEDIR)/xen-syms.S $(MAKE) -f $(BASEDIR)/Rules.mk $(BASEDIR)/xen-syms.o $(LD) $(LDFLAGS) -T xen.lds -N \ - boot/$(TARGET_SUBARCH).o $(ALL_OBJS) $(BASEDIR)/xen-syms.o -o $@ + boot/$(TARGET_SUBARCH).o $(ALL_OBJS) \ + $(BASEDIR)/xen-syms.o -o $@ rm -f $(BASEDIR)/xen-syms.S $(BASEDIR)/xen-syms.o asm-offsets.s: $(TARGET_SUBARCH)/asm-offsets.c $(HDRS) diff --git a/xen/common/symbols-dummy.c b/xen/common/symbols-dummy.c new file mode 100644 index 0000000000..562264f4e7 --- /dev/null +++ b/xen/common/symbols-dummy.c @@ -0,0 +1,16 @@ +/* + * symbols-dummy.c: dummy symbol-table definitions for the inital partial + * link of the hypervisor image. + */ + +#include +#include + +unsigned long symbols_addresses[1]; +unsigned long symbols_num_syms; +u8 symbols_names[1]; + +u8 symbols_token_table[1]; +u16 symbols_token_index[1]; + +unsigned long symbols_markers[1]; diff --git a/xen/common/symbols.c b/xen/common/symbols.c index 84e04d973c..6bc3956a13 100644 --- a/xen/common/symbols.c +++ b/xen/common/symbols.c @@ -16,15 +16,14 @@ #include #include -/* These will be re-linked against their real values during the second link stage */ -extern unsigned long symbols_addresses[] __attribute__((weak)); -extern unsigned long symbols_num_syms __attribute__((weak,section("data"))); -extern u8 symbols_names[] __attribute__((weak)); +extern unsigned long symbols_addresses[]; +extern unsigned long symbols_num_syms; +extern u8 symbols_names[]; -extern u8 symbols_token_table[] __attribute__((weak)); -extern u16 symbols_token_index[] __attribute__((weak)); +extern u8 symbols_token_table[]; +extern u16 symbols_token_index[]; -extern unsigned long symbols_markers[] __attribute__((weak)); +extern unsigned long symbols_markers[]; /* expand a compressed symbol data into the resulting uncompressed string, given the offset to where the symbol is in the compressed stream */ -- 2.30.2